package ge.telasi.tasks.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * @author dimitri
 */
@Entity
@Table(name = "binary_data")
public class BinaryData implements Serializable {
    private static final long serialVersionUID = -7166351418626528070L;

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "BINARY_DATA_SEQ")
	@SequenceGenerator(name = "BINARY_DATA_SEQ", sequenceName = "BINARY_DATA_SEQ", allocationSize = 1)
    private Long id;
    @Lob
    @Column(name = "content")
    private byte[] content;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }

    @Override
    protected void finalize() throws Throwable {
        content = null;
        super.finalize();
    }

}
